

<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@include file="/pageRc/common/common.jsp"%>

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
	<meta name="format-detection" content="telephone=no">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="mobile-web-app-capable" content="yes">
	<meta name="msapplication-tap-highlight" content="no">
	<script type="text/javascript" src="<%=commonPath %>/pageRc/js/jquery-1.9.1.min.js"></script> 
 　	<link rel="stylesheet" href="<%=commonPath %>/pageRc/layui/css/layui.css" media="all">
 　　　<script type="text/javascript" src="<%=commonPath %>/pageRc/common/utils.js"></script>
	<script type="text/javascript" src="<%=commonPath %>/pageRc/common/msgTool.js"></script>
	<script type="text/javascript" src="<%=commonPath %>/pageRc/layui/layui.js"></script>　
	<title>修改需求信息</title> 
	<script type="text/javascript">
	var path = "<%=commonPath%>";
	var msg =new msgTool(); 
 
	</script>
</head>

 <body style="layui-main">
	 <div class="header">
	  <div class="main">
	    <div class="nav">
	      <blockquote class="layui-elem-quote">hi, ${userBean.userName} ，你好！</blockquote>   
	    </div> 
	  </div>
	</div>
             <form  id="createMsgForm" name="createMsgForm"  class="layui-form"  style="padding:1.5rem"  >
               <div class="layui-form-item">
                 <label class="layui-form-label">所属项目组</label>
	              <div class="layui-input-block"> 
	                  <input id="rouid"  name = "rouid"  value="${needBean.rouid}"  type="hidden">
	                  <input id="proTeamNo"  name = "proTeamNo"  value="${needBean.proTeamNo}"  type="hidden">
	                  <input id="proTeamName"  name = "proTeamName"  value="${needBean.proTeamName}"  class="layui-input" disabled>
 	              </div>
               </div>
               <div class="layui-form-item">
                 <label class="layui-form-label">需求编号</label>
	              <div class="layui-input-block"> 
	                  <input id="needNo"  name = "needNo"    class="layui-input"  placeholder="请输入需求编号" value="${needBean.needNo}"   required lay-verify="required" autocomplete="off" >
 	              </div>
               </div>
               <div class="layui-form-item">
                <label  class="layui-form-label">需求名称</label>
                <div class="layui-input-block">
                    <input type="text" id="needName"  name="needName"  placeholder="请输入需求名称"  value="${needBean.needName}"  name="needName" required lay-verify="required" autocomplete="off" class="layui-input">
                </div>
              </div>   
              <div class="layui-form-item"> 
                <label  class="layui-form-label">评估工时  </label> 
                <div class="layui-input-block">
                  <input type="number" id="needTime" name="needTime"  value="${needBean.needTime}"   placeholder="按小时填写"   required lay-verify="required" autocomplete="off" class="layui-input">
                 </div>
              </div>  
              <div class="layui-form-item"> 
              	<div class="layui-input-block">
	              	  <c:choose>
	              	 	 <c:when test="${needBean.state=='02'}">
	              	 	 	<button class="layui-btn" lay-filter="submitData" lay-submit>修改提交</button>
	              			<button class="layui-btn" type="button" style="background-color: red;" onclick="custom_close()">需求已关闭</button>	 	 	
	              		 </c:when>
	              		 <c:otherwise>
	              		 	  <button class="layui-btn" lay-filter="submitData" lay-submit>修改提交</button>
	              		 	  <button class="layui-btn" type="button" onclick="closeTask('${needBean.rouid}')" style="background-color: red;">关闭任务</button> 	 	
	              		 </c:otherwise>
	              	 </c:choose> 
    	          </div>
              </div>  
          </form> 
<script> 
  layui.use(
		[ 'form', 'layer', 'laytpl', 'laypage','laydate' ],
		 function(){
			var form = layui.form(),
			layer = layui.layer;
			 var index = parent.layer.getFrameIndex(window.name); //获取当前窗体索引
			form.on('submit(submitData)',function(data){
				var field = data.field;
				if(field.needTime<=80){
					   layer.confirm("你确定你的评估工时的单位是小时吗？如果不是请点击取消。",{icon:3,title:"提示"},function(index){
 						   msg.sendMsg("/page/need/updateNeedInfor.do",field,function(data){ //新加的微信登录入口
								/* layer.alert("修改成功！"); */
								index = parent.layer.getFrameIndex(window.name);
								if(index>=1)
				                    parent.layer.close(index); //执行关闭
				                else
									location.href ="<%=commonPath %>/page/need/doShowNeedInfor.do";
							}); 
					   }); 
				}else{
					 msg.sendMsg("/page/need/updateNeedInfor.do",field,function(data){ //新加的微信登录入口
							/* layer.alert("修改成功！"); */
							if(index>=1)
			                    parent.layer.close(index); //执行关闭
			                else
								location.href ="<%=commonPath %>/page/need/doShowNeedInfor.do";
						}); 
				}
				return false;
			});
});
  function closeTask(rouid) {
      var jsonDate = {};
      jsonDate.rouid = rouid;
      var index = parent.layer.getFrameIndex(window.name); //获取当前窗体索引
      layer.confirm("你确定要关闭这个任务吗?",{icon:3,title:"提示"},function(index){
				msg.sendMsg("/page/base/closeNeedInfor.do",jsonDate,function(data){ //新加的微信登录入口
					index = parent.layer.getFrameIndex(window.name);
					if(index>=1)
	                    parent.layer.close(index); //执行关闭
	                else
				  		location.href ="<%=commonPath %>/page/base/dologin.do";
				});
		   }); 
  }
  function custom_close(){
	  window.opener=null;
	  window.open('','_self');
	  window.close();
  }
</script>
</body>
</html>
 
 